#include <QApplication>
#include <QVBoxLayout>
#include <QLCDNumber>
#include <QSlider>
#include "myglwidget.h"

class MyWidget : public QWidget
{
public:
    MyWidget(QWidget *parent = 0);
};
MyWidget::MyWidget(QWidget *parent)
    : QWidget(parent)
{
    MyGLWidget *window = new MyGLWidget(60, this, "Fenetre opengl");


    QLCDNumber *lcd = new QLCDNumber(3, this);
    lcd->setSegmentStyle(QLCDNumber::Filled);

    QSlider *slider = new QSlider(Qt::Horizontal);
    slider->setRange(0, 360);
    slider->setValue(0);

    //On connecte le slider au lcd
    QObject::connect(slider, SIGNAL(valueChanged(int)), lcd, SLOT(display(int)));
    QObject::connect(slider, SIGNAL(valueChanged(int)), window, SLOT(setAngle(int)));

    QVBoxLayout *layout = new QVBoxLayout;
    layout->addWidget(window, 3);
    layout->addWidget(lcd, 1);
    layout->addWidget(slider, 1);

    setLayout(layout);
    window->setFocus();
}


int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    MyWidget widget;
    widget.show();

    return app.exec();


}

